package demo.spring.boot.health;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.List;

/**
 * Tests
 * <p>
 * Created by chenlushun on 2016/12/8.
 */
@Controller
@RequestMapping
public class HelloWordController {

    /**
     * 一个简单的请求
     */
    @RequestMapping(value = "/", method = RequestMethod.POST)
    public String sayHello(Demo demo, String sd) {
        if (demo != null) {
            System.out.println(demo.getMapIds());
            System.out.println(demo.getPassword());
            System.out.println(demo.getUsername());
            System.out.println(sd);
        }
        return "login";
    }

    @RequestMapping(value = "/login")
    public String login(ModelMap modelMap) {
        List<String> list = new ArrayList<>();
        list.add("张三");
        list.add("里斯");
        list.add("王麻子");
        modelMap.addAttribute("list", list);
        return "login";
    }

}
